const CracoLessPlugin = require("craco-less");
const CracoAlias = require("craco-alias");

module.exports = {
  plugins: [
    // 一旦配置自定义主题，将来可以使用less写样式
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            // 覆盖antd.less定义的变量
            // https://ant.design/docs/react/customize-theme-cn#Ant-Design-%E7%9A%84%E6%A0%B7%E5%BC%8F%E5%8F%98%E9%87%8F
            modifyVars: { "@primary-color": "#1DA57A" },
            javascriptEnabled: true,
          },
        },
      },
    },
    // 路径别名
    // https://www.npmjs.com/package/craco-alias#examples
    {
      plugin: CracoAlias,
      options: {
        // source: "options",
        baseUrl: "./", // 基础路径
        aliases: {
          "@": "./src",
          "@api": "./src/api",
          "@comps": "./src/components",
        },
      },
    },
  ],
};